home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 January - Disc 2 / Macworld (1999-01) (Disk 2).dmg / Serious Demos / Symbolic Composer 4.2 / Environment / Projects / Questions & Answers / Q&A Programming Music / How to make permutations? < prev    next >
Lisp/Scheme  |  1998-10-26  |  4KB  |  126 lines

  1. HOW TO MAKE PERMUTATIONS
  2.  
  3. >I want to create permutations of a melody such that the pitches are shifted 
  4. >one note to the left. That is the permutation starts with the second pitch 
  5. >of the original series but with the rhythmic value of the first note etc. 
  6.  
  7. Melodies in SCOM are represented as symbol patterns, like (a b c d e). 
  8.  
  9. (setq melody '(a b c d e))
  10.  
  11. You can rotate the symbol pattern with symbol-scroll:
  12.  
  13. (symbol-scroll 1 melody)
  14. --> (e a b c d)
  15.  
  16. (symbol-scroll 2 melody)
  17. --> (d e a b c)
  18.  
  19. Let's cook a simple score. Here all play in chromatic tonality starting at c 4.
  20. No tonality changes for now. Piano starts first, then bass starts at bar 5 and
  21. then clarinet starts at bar 9.
  22.  
  23. All instruments use same rhythmic and will play in rhythmic unison, but the
  24. melody is scrolled as in above with symbol-scroll. Each instrument uses velocity
  25. value 64.
  26.  
  27. Let's define the orchestra.
  28.  
  29. (def-orchestra 'orchestra
  30.    all-instr (piano bass clarinet)
  31. )
  32.  
  33. Let's define a section.
  34.  
  35. (def-section-timesheet sect-a
  36.    ;
  37.    ; zones and tonalities
  38.    ;
  39.    with 1/1   ;1   5   9   these are bars
  40.    ;           !---!---!---!---!---!---!---!---!
  41.    tonality   "." (activate-tonality (chromatic c 4))
  42.    piano      "----------------" 
  43.    bass       "   -------------" 
  44.    clarinet   "      ----------" 
  45.    ;
  46.    ; rhythmics, melodies and velocities
  47.    ;
  48.    beat 1/16 ; !---!---!---!---! ; each column here is now 1/16 note
  49.    legato 90
  50.    piano      "-  -- - - - --- " melody with '(64)  ; the string here is a rhythmic pattern
  51.    bass       "-  -- - - - --- " (symbol-scroll 1 melody) with '(64)
  52.    clarinet   "-  -- - - - --- " (symbol-scroll 2 melody) with '(64)
  53. )
  54.  
  55. (midiport :printer)
  56.  
  57. Let's play it.
  58.  
  59. (play-file-p "permutations"
  60.    all-instr '(sect-a)
  61. )
  62.  
  63. Note, use symbol-shift for creating rest notes:
  64.  
  65. (symbol-shift 1 melody)
  66. --> (= a b c d)
  67.  
  68. (symbol-shift 2 melody)
  69. --> (= = a b c)
  70.  
  71. >If I understand the symbol-tonality relationship correctly 
  72. >it can be used to transpose a series of pitches into any arbitrary scale.
  73.  
  74. You can use symbol-transpose:
  75.  
  76. (symbol-transpose 1 melody)
  77. --> (b c d e f)
  78.  
  79. Or you can combine the functions
  80.  
  81. (symbol-transpose 1 (symbol-scroll 1 melody))
  82. --> (f b c d e)
  83.  
  84. Symbols are mapped on the tonality so that a maps to the first note of
  85. the active tonality, b the second, c the third and so on. When the
  86. tonality is a scale like the chromatic in the above example you can
  87. play the notes of that scale. A chord tonality, or a microtonal tuning
  88. tonality can also be used. You can change tonalities, and use different
  89. tonalities for each instrument, if necessary. It is a very flexible 
  90. system and there are lots of generators and processors for both
  91. symbols and tonalities.
  92.  
  93. >That is if the original series goes up by step for four notes 
  94. >then the transposed series goes up by step in the new scale and 
  95. >the new scale could consist of a series of intervals 
  96. >each of which is greater than an octave right Sorry if this is not 
  97. >clear.
  98.  
  99. In the above you could give each instrument its own tonality. Let's
  100. keep piano playing chromatic scale. Let bass switch between chromatic
  101. and major scales playing 2 bars each. And let clariner switch
  102. tonalities in each bar using 3 hirajoshi scale in different transpose
  103. positions. See the dots, they represent tonality change points. In
  104. our example each column is defined to be one bar, but technically it 
  105. could be of any size and different for each instrument. SCOM does not
  106. represent limitations on those things.
  107.  
  108.    tonality   "." (activate-tonality (chromatic c 4))
  109.    piano      "----------------" 
  110.    tonality   "  . . . . . . . " (activate-tonality (chromatic c 4) 
  111.                                                     (major c 4))
  112.    bass       "   -------------" 
  113.    tonality   "................" (activate-tonality (hirajoshi c 4) 
  114.                                                     (hirajoshi d 3) 
  115.                                                     (hirajoshi e 2))
  116.    clarinet   "      ----------" 
  117.  
  118. >So is the interface simply a text editor
  119.  
  120. Just write it in aboveand then compile it to music which takes few 
  121. seconds or a couple of minutes for complex scores. Your previous score 
  122. plays in the background while compiling new material and it is nice to 
  123. search sounds while waiting the new piece to finish. Rhythmics can also 
  124. be notated as ratios like 1/16. 1/4.... 1/4-3 (triplet) etc.
  125.  
  126.